package net.ssta.core.util.format;

import java.sql.Date;
import java.sql.SQLException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

import oracle.sql.TIMESTAMP;
import oracle.sql.TIMESTAMPLTZ;
import oracle.sql.TIMESTAMPTZ;

public class OracleTimestampFormat extends ValueObjectFormat
{
	private static DateFormat s_dateFormat_yyyyMMddHHmmss = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	public String getString(Object value, String defaultValue)
	{
		if(value == null) return defaultValue;
		try
		{
			return s_dateFormat_yyyyMMddHHmmss.format(((TIMESTAMP)value).timestampValue());
		}
		catch (SQLException e)
		{
			return defaultValue;
		}
	}
}
